package br.com.djiadreams.servicesereceivers;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

import br.com.djiadreams.basededados.InfosDAO;

import android.content.Context;
import android.util.Log;

public class UploadService {

	@SuppressWarnings("unused")
	private Context c;
	@SuppressWarnings("unused")
	private InfosDAO db;

	public UploadService(Context c) {
		this.c = c;
	}

	public boolean enviar() {

		/*
		 * db = new InfosDAO(c);
		 * List<Infos> lista = db.listar();
		 */
		return false;
	}

	public boolean hasActiveInternetConnection() {
		try {
			HttpURLConnection urlc = (HttpURLConnection) (new URL(
					"http://www.google.com").openConnection());
			urlc.setRequestProperty("User-Agent", "Test");
			urlc.setRequestProperty("Connection", "close");
			urlc.setConnectTimeout(1500);
			urlc.connect();
			return (urlc.getResponseCode() == 200);
		} catch (IOException e) {
			Log.e("NO_CONNECTION", "Error checking internet connection", e);
		}
		return false;
	}
}
